package com.ruoyi.net.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.net.mapper.ElementProtectGroupMapper;
import com.ruoyi.net.domain.ElementProtectGroup;
import com.ruoyi.net.service.IElementProtectGroupService;

/**
 * 网元-保护配置-细粒度保护组Service业务层处理
 * 
 * @author net
 * @date 2024-11-17
 */
@Service
public class ElementProtectGroupServiceImpl implements IElementProtectGroupService 
{
    @Autowired
    private ElementProtectGroupMapper elementProtectGroupMapper;

    /**
     * 查询网元-保护配置-细粒度保护组
     * 
     * @param id 网元-保护配置-细粒度保护组主键
     * @return 网元-保护配置-细粒度保护组
     */
    @Override
    public ElementProtectGroup selectElementProtectGroupById(String id)
    {
        return elementProtectGroupMapper.selectElementProtectGroupById(id);
    }

    /**
     * 查询网元-保护配置-细粒度保护组列表
     * 
     * @param elementProtectGroup 网元-保护配置-细粒度保护组
     * @return 网元-保护配置-细粒度保护组
     */
    @Override
    public List<ElementProtectGroup> selectElementProtectGroupList(ElementProtectGroup elementProtectGroup)
    {
        return elementProtectGroupMapper.selectElementProtectGroupList(elementProtectGroup);
    }

    /**
     * 新增网元-保护配置-细粒度保护组
     * 
     * @param elementProtectGroup 网元-保护配置-细粒度保护组
     * @return 结果
     */
    @Override
    public int insertElementProtectGroup(ElementProtectGroup elementProtectGroup)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(elementProtectGroup.getId())) {
            elementProtectGroup.setId(uuid);
        }
        elementProtectGroup.setCreateBy(SecurityUtils.getUsername());
        elementProtectGroup.setCreateTime(DateUtils.getNowDate());
        elementProtectGroup.setUpdateBy(SecurityUtils.getUsername());
        elementProtectGroup.setUpdateTime(DateUtils.getNowDate());
        return elementProtectGroupMapper.insertElementProtectGroup(elementProtectGroup);
    }

    /**
     * 修改网元-保护配置-细粒度保护组
     * 
     * @param elementProtectGroup 网元-保护配置-细粒度保护组
     * @return 结果
     */
    @Override
    public int updateElementProtectGroup(ElementProtectGroup elementProtectGroup)
    {
        elementProtectGroup.setUpdateBy(SecurityUtils.getUsername());
        elementProtectGroup.setUpdateTime(DateUtils.getNowDate());
        return elementProtectGroupMapper.updateElementProtectGroup(elementProtectGroup);
    }

    /**
     * 批量删除网元-保护配置-细粒度保护组
     * 
     * @param ids 需要删除的网元-保护配置-细粒度保护组主键
     * @return 结果
     */
    @Override
    public int deleteElementProtectGroupByIds(String[] ids)
    {
        return elementProtectGroupMapper.deleteElementProtectGroupByIds(ids);
    }

    /**
     * 删除网元-保护配置-细粒度保护组信息
     * 
     * @param id 网元-保护配置-细粒度保护组主键
     * @return 结果
     */
    @Override
    public int deleteElementProtectGroupById(String id)
    {
        return elementProtectGroupMapper.deleteElementProtectGroupById(id);
    }

    @Override
    public ElementProtectGroup selectElementProtectGroupByEleId(String elementId) {
        return elementProtectGroupMapper.selectElementProtectGroupByEleId(elementId);
    }
}
